package com.sz.admin.vehicleinfo.pojo.po;

import com.mybatisflex.annotation.*;
import com.mybatisflex.core.handler.JacksonTypeHandler;
import com.sz.admin.vehicleinfo.pojo.vo.VehicleInfoVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.io.Serial;
import com.sz.mysql.EntityChangeListener;

import java.time.LocalDateTime;
import java.util.List;

/**
* <p>
* 车辆管理
* </p>
*
* @author sz-admin
* @since 2025-08-29
*/
@Data
@Table(value = "vehicle_info", onInsert = EntityChangeListener.class, onUpdate = EntityChangeListener.class)
@Schema(description = "车辆管理")
public class VehicleInfo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Auto)
    @Schema(description ="id")
    private Long id;

    @Schema(description ="车辆编号")
    private String vehicleNumber;

    @Schema(description ="名称")
    private String title;

    @Schema(description ="司机名称")
    private String driverName;

    @Schema(description ="司机名称2")
    private String driverName2;

    @Schema(description ="司机名称3")
    private String driverName3;

    @Schema(description ="司机用户ID1")
    private Long userId1;

    @Schema(description ="司机用户ID2")
    private Long userId2;

    @Schema(description ="司机用户ID3")
    private Long userId3;

    @Schema(description ="排序")
    private Integer sort;

    @Schema(description ="车辆类型 （字典表vehicle_type）")
    private String vehicleTypeCd;

    @Schema(description ="是否隐藏")
    private String isHidden;

    @Schema(description ="创建时间")
    private LocalDateTime createTime;

    @Schema(description ="更新时间")
    private LocalDateTime updateTime;

    @Schema(description ="创建人ID")
    private Long createId;

    @Schema(description ="更新人ID")
    private Long updateId;

    @Column(isLogicDelete = true)
    @Schema(description ="是否删除")
    private String delFlag;

    @Schema(description ="删除人ID")
    private Long deleteId;

    @Schema(description ="删除时间")
    private LocalDateTime deleteTime;

    @Schema(description ="部门id")
    private Long departmentId;

    @Schema(description = "部门范围id")
    @Column(typeHandler = JacksonTypeHandler.class)
    private List<Long> deptScope;

    @Schema(description =  "排班id")
    private Long scheduleId;

    // 关联查询部门信息（只关联部门表）
    //@Relation(oneToOne, targetField = "id", valueField = "departmentId")
    //@RelationOneToOne(targetField = "accountId")
    //@RelationManyToOne(selfField = "departmentId", targetField = "id")
    //private Account account;
    // 关键：使用 @Relation 注解定义多对一关系
    @RelationManyToOne(
            selfField = "departmentId",
            targetField = "id",
            targetTable = "tb_id_card",
            valueField = "deptName"
    )
    private List<VehicleInfoVO> vehicleInfoVOList;

}